<!DOCTYPE html>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<pre></pre>
<script>
test(() => {
  const node = document.querySelector('pre'); 
  for (let j = 0; j < 5; ++j) {
    const child = document.createElement('div');
    child.innerHTML = j + 1;
    node.appendChild(child);
    for (let i = node.childNodes.length - 1; i >= 0; --i) {
        const actual = node.childNodes[i] ? node.childNodes[i].innerHTML
                                          : undefined;
        assert_equals(actual, (i + 1).toString(),
                      `child[${i}] after adding child[${j}]`);
    }
  }
}, 'Node#childNodes reverse iteration');
</script>
